package com.chapala.interviewquestions;

import java.util.regex.*;

public class Match {
	public static void main(String[] args) {
		Pattern p = Pattern.compile("(aa|aab?)+");
		int count = 0;
		for (String s = ""; s.length() < 200; s += "a") {
			System.out.println(s);
			if (p.matcher(s).matches())
				count++;
			System.out.println(count+":"+s.length());
		}
		System.out.println(count);
	}
}